﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Data;

namespace BUS
{
    public class Validations
    {
        public static bool IsNullOrEmptyTextboxNull(string inputTenKhachHang)
        {
            if (String.IsNullOrEmpty(inputTenKhachHang))
                return (true);
            else
                return (false);
        }
        public static bool isValidEmail(string inputEmail)
        {
            string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
                  @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
                  @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(inputEmail))
                return (true);
            else
                return (false);
        }
       
        public static bool isValidPhoneNumber(string inputPhoneNumber)
        {
            string strRegex = @"^(0\d{9,10})$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(inputPhoneNumber))
                return (true);
            else
                return (false);
        }

        public static bool isValidNumberOnly(string inputNumberOnly)
        {
            string strRegex = @"^[0-9]$";
            Regex re = new Regex(strRegex);
            if (re.IsMatch(inputNumberOnly))
                return (true);
            else
                return (false);
        }
    }
}
